<?php

namespace Biz\model\salesRebate;

use Doraemon\pockets\datebase\BaseDbModel;

class SalesCouponMap extends BaseDbModel
{
    const _CONFIG_FILE_ = 'db_shop';

    const _CONFIG_SELECT_ = 'db_sales_rebate';

    const _DATABASE_ = 'biz_sales_rebate';

    const _TABLE_NAME = 'sales_coupon_map';

    const COUPON_TYPE_PERSON = 1;//节选个人
    const COUPON_TYPE_COMPANY = 2;//节选公司
    const COUPON_TYPE_APP = 3;//app返利

    const STATUS_NORMAL = 1;
    const STATUS_DELETE = 0;


    public static function getCouponsByCouponId($couponIds)
    {
        return self::select('*', [
            'coupon_id' => $couponIds,
            'coupon_status' => self::STATUS_NORMAL
        ]);
    }
    public static function selectByWhere($where, $field = '*')
    {
        return self::select($field, $where);
    }

    public static function getCountWhere($where, $field = '*')
    {
        return self::count($where);
    }
    public static function addCoupons($couponInfo)
    {
        self::insert($couponInfo);
    }
}